<?php
namespace app\index\model;
use think\Model;
use traits\model\SoftDelete;
class Admin extends Model
{
  /**
   * 登录
   */
  public function login($data){
    $admin = Admin::get(['user'=>$data['user']]);
    if($admin){
      if($admin['password']==$data['password']){
        session('id',$admin['id']);
        session('user',$admin['user']);
        return 2; //登录密码正确 
      }else{
        return 3; //登录密码错误
      }
    }else{
      return 1; //用户不存在
    }
  }
}
?>